home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / kernel / dirk20.1 < prev    next >
Text File  |  1989-02-17  |  53KB  |  1,334 lines

  1. Path: xanth!nic.MR.NET!hal!cwjcc!mailrus!ulowell!page
  2. From: page@swan.ulowell.edu (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i022:  dirk - system resource monitor v2.0
  5. Message-ID: <11761@swan.ulowell.edu>
  6. Date: 17 Feb 89 01:32:46 GMT
  7. Organization: University of Lowell, Computer Science Dept.
  8. Lines: 1323
  9. Approved: page@swan.ulowell.edu
  10.  
  11. Submitted-by: elbaum@REED.BITNET (Daniel Elbaum)
  12. Posting-number: Volume 89, Issue 22
  13. Archive-name: kernel/dirk20.1
  14.  
  15. #    This is a shell archive.
  16. #    Remove everything above and including the cut line.
  17. #    Then run the rest of the file through sh.
  18. #----cut here-----cut here-----cut here-----cut here----#
  19. #!/bin/sh
  20. # shar:    Shell Archiver
  21. #    Run the following text with /bin/sh to create:
  22. #    adjust.c
  23. #    arg.c
  24. #    dirk.doc
  25. #    dirk.h
  26. #    dirk.uu
  27. #    main.c
  28. #    makefile
  29. #    sys.c
  30. #    window.c
  31. # This archive created: Thu Feb 16 20:28:49 1989
  32. cat << \SHAR_EOF > adjust.c
  33.  
  34. /***************************************************************************
  35.     1/89
  36.  
  37.         DIRK v2.0 -- Tune workbench colors to system performance
  38.  
  39.         Copyright (C) 1989 by Daniel Elbaum
  40.  
  41.         This software is freely redistributable provided that:
  42.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  43.         adjust.c, main.c, sys, window.c) remain intact; all
  44.         copyright notices contained in any of the aforementioned
  45.         files remain intact; and no fee beyond reasonable remuneration
  46.         for collation and distribution be charged for use and/or
  47.         distribution.
  48.  
  49. ***************************************************************************/
  50.  
  51.  
  52. #include "dirk.h"
  53.  
  54. #define T_LEFT   (6)    /* centers text nicely              */
  55. #define T_HEIGHT (10)
  56. #define T_TOP    (WINHT1+4)
  57.  
  58. void
  59. setcolor(sp, tm, g_f)
  60. register struct Screen *sp;
  61. ULONG tm;
  62. t_gf *g_f;
  63. {
  64.     register f, db, t;
  65.     int tr, tw;
  66.     int dr, dg, db;     /* detail red, blue, green  */
  67.     int br, bg, bb;     /* bkgnd red, blue, green   */
  68.     ULONG mu, fm;
  69.     ULONG amtfree();
  70.  
  71.     if (g_f->dstog){
  72.         tqlen(&tr, &tw);
  73.  
  74.         f=CMAX-(tr+tw)/g_f->gran;
  75.         if (f<g_f->dsmin) f=g_f->dsmin;
  76.         if (f>g_f->dsmax) f=g_f->dsmax;
  77.         if ((t=tr/g_f->gran+f)>CMAX) t=CMAX;
  78.         /* Detail and Block pens seem to be reversed    */
  79.  
  80.         if ((dr=t+g_f->bd_r)>CMAX) dr=CMAX;
  81.         if ((dg=t+g_f->bd_g)>CMAX) dg=CMAX;
  82.         if ((db=t+g_f->bd_b)>CMAX) db=CMAX;
  83.     }
  84.  
  85.     /* val = minval + ((mused / mtotal) * (maxval - minval)) */
  86.     if (g_f->bstog){
  87.         fm=amtfree();
  88.         mu=tm-fm;
  89.         br=g_f->lb_r+(mu*g_f->db_r)/tm;
  90.         bg=g_f->lb_g+(mu*g_f->db_g)/tm;
  91.         bb=g_f->lb_b+(mu*g_f->db_b)/tm;
  92.     }
  93.  
  94.     Forbid();
  95.     if (g_f->dstog) SetRGB4(sp->ViewPort, sp->BlockPen, dr, dg, db);
  96.     if (g_f->bstog) SetRGB4(sp->ViewPort, sp->DetailPen, br, bg, bb);
  97.     Permit();
  98. }
  99.  
  100. #define N_TEXT  (8)
  101. typedef struct IntuiText t_it;
  102.  
  103. void
  104. fillwin(wp)
  105. struct Window *wp;
  106. {
  107.     register i;
  108.     int tr, tw;
  109.     ULONG cavail, favail;
  110.     char trbu[24], twbu[24], cabu[24], fabu[24];
  111.     t_it *ita[N_TEXT];
  112.  
  113.     memset(ita, 0, sizeof(ita));
  114.     for (i=0; i<N_TEXT; ++i)
  115.         if (!(ita[i]=(t_it *)AllocMem(sizeof(t_it), MEMF_PUBLIC|MEMF_CLEAR)))
  116.             break;
  117.     if (i<N_TEXT){
  118.         for (i=0; i<N_TEXT; ++i)
  119.             if (ita[i]) FreeMem(ita[i], sizeof(t_it));
  120.         return;
  121.     }
  122.     Forbid();
  123.     cavail=AvailMem(MEMF_CHIP);
  124.     favail=AvailMem(MEMF_FAST);
  125.     Permit();
  126.  
  127.     tqlen(&tr, &tw);
  128.     sprintf(trbu, "Ready:    %3.3d", tr);
  129.     sprintf(twbu, "Waiting:  %3.3d", tw);
  130.     sprintf(cabu, "Chip: %7.7d", cavail);
  131.     sprintf(fabu, "Fast: %7.7d", favail);
  132.  
  133.     ita[0]->FrontPen=wp->BlockPen;
  134.     ita[0]->BackPen=wp->DetailPen;
  135.     ita[0]->DrawMode=JAM2;
  136.  
  137.     for (i=1; i<N_TEXT; ++i)
  138.         memcpy(ita[i], ita[0], sizeof(t_it));
  139.  
  140.     ita[0]->TopEdge=0;
  141.     ita[0]->IText="2.0  (C) 1989";
  142.     ita[0]->NextText=ita[1];
  143.     ita[1]->TopEdge=T_HEIGHT;
  144.     ita[1]->IText="Daniel Elbaum";
  145.     ita[1]->NextText=ita[2];
  146.     ita[2]->TopEdge=T_HEIGHT*3;
  147.     ita[2]->IText="    Tasks";
  148.     ita[2]->NextText=ita[3];
  149.     ita[3]->IText=trbu;
  150.     ita[3]->TopEdge=T_HEIGHT*4;
  151.     ita[3]->NextText=ita[4];
  152.     ita[4]->IText=twbu;
  153.     ita[4]->TopEdge=T_HEIGHT*5;
  154.     ita[4]->NextText=ita[5];
  155.     ita[5]->IText="  Memories";
  156.     ita[5]->LeftEdge=6;
  157.     ita[5]->TopEdge=T_HEIGHT*7;
  158.     ita[5]->NextText=ita[6];
  159.     ita[6]->IText=cabu;
  160.     ita[6]->TopEdge=T_HEIGHT*8;
  161.     ita[6]->NextText=ita[7];
  162.     ita[7]->IText=fabu;
  163.     ita[7]->TopEdge=T_HEIGHT*9;
  164.     ita[7]->NextText=NULL;
  165.  
  166.     PrintIText(wp->RPort, ita[0], T_LEFT, T_TOP);
  167.     for (i=0; i<N_TEXT; ++i)
  168.         FreeMem(ita[i], sizeof(t_it));
  169.     return;
  170. }
  171.  
  172. SHAR_EOF
  173. cat << \SHAR_EOF > arg.c
  174. /***************************************************************************
  175.     1/89
  176.  
  177.         DIRK v2.0 -- Tune workbench colors to system performance
  178.  
  179.         Copyright (C) 1989 by Daniel Elbaum
  180.  
  181.         This software is freely redistributable provided that:
  182.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  183.         adjust.c, main.c, sys, window.c) remain intact; all
  184.         copyright notices contained in any of the aforementioned
  185.         files remain intact; and no fee beyond reasonable remuneration
  186.         for collation and distribution be charged for use and/or
  187.         distribution.
  188.  
  189. ***************************************************************************/
  190.  
  191.  
  192. #include "dirk.h"
  193.  
  194. getargs(v, f)
  195. char **v;
  196. t_gf *f;
  197. {
  198.     register out=0;
  199.  
  200.     f->gran  = 4;      /*  good when 4-5 processes are in background   */
  201.     f->dsmax = 12;     /*  takes some glare out of text                */
  202.     f->dsmin = 8;      /*  readable even at near-red                   */
  203.     f->dstog = 1;      /*  task watcher on by default                  */
  204.     f->bstog = 1;      /*  memory watcher on by default                */
  205.     f->intvl = 180;    /*  default delay is 3 seconds                  */
  206.     f->bd_r  = 2;      /*  increment for detail pen red                */
  207.     f->bd_g  = 2;      /*  increment for detail pen green              */
  208.     f->bd_b  = 0;      /*  increment for detail pen blue               */
  209.  
  210.     f->hb_r  = 14;      /*  go from blue 14 to red 14 as memory fills   */
  211.     f->hb_g  = 0;
  212.     f->hb_b  = 0;
  213.     f->lb_r  = 0;
  214.     f->lb_g  = 0;
  215.     f->lb_b  = 14;
  216.  
  217.     while (*v){
  218.         if (**v=='-') {
  219.             if (!(*v)[1]) return(usage());
  220.             while (*++*v){
  221.                 switch(**v){
  222.                     case 'g': f->gran=atoi(++*v); ++out; break;
  223.                     case 'h': f->dsmax=atoi(++*v); ++out; break;
  224.                     case 'l': f->dsmin=atoi(++*v); ++out; break;
  225.                     case 'i': f->intvl=atoi(++*v); ++out; break;
  226.                     case 't': f->bstog=0; break;
  227.                     case 'm': f->dstog=0; break;
  228.                     case 'd':
  229.                         switch(*++*v){
  230.                             case 'r': f->bd_r=atoi(++*v); ++out; break;
  231.                             case 'g': f->bd_g=atoi(++*v); ++out; break;
  232.                             case 'b': f->bd_b=atoi(++*v); ++out; break;
  233.                             default: return(usage());
  234.                         }
  235.                         break;
  236.                     case 'e':
  237.                         switch(*++*v){
  238.                             case 'r': f->lb_r=atoi(++*v); ++out; break;
  239.                             case 'g': f->lb_g=atoi(++*v); ++out; break;
  240.                             case 'b': f->lb_b=atoi(++*v); ++out; break;
  241.                             default: return(usage());
  242.                         }
  243.                         break;
  244.                     case 'f':
  245.                         switch(*++*v){
  246.                             case 'r': f->hb_r=atoi(++*v); ++out; break;
  247.                             case 'g': f->hb_g=atoi(++*v); ++out; break;
  248.                             case 'b': f->hb_b=atoi(++*v); ++out; break;
  249.                             default: return(usage());
  250.                         }
  251.                         break;
  252.                     default: return(usage());
  253.                 }                               /* switch (**v) */
  254.                 if (out) {++v; break;}
  255.             }                               /* while (*++*v)  */
  256.             if (!out) ++v;
  257.             else out=0;
  258.         }                               /* else if (**v=='+')   */
  259.         else {
  260.             return(usage());
  261.         }
  262.     }                               /* while (*v)   */
  263.     limit(f);
  264.     if (f->gran==0) f->gran=1;  /* special case for x/gran  */
  265.     return(0);
  266. }
  267.  
  268. #define LFIX(x, l)   if (x<l) x=l
  269. #define HFIX(x, h)   if (x>h) x=h
  270.  
  271. /*
  272.     Make sure all members of *f are in bounds.
  273. */
  274.  
  275. limit(f)
  276. t_gf *f;
  277. {
  278.     int tmp;
  279.     int maxint=(1<<sizeof(maxint))-1;
  280.  
  281.  
  282.     LFIX(f->gran, 0);
  283.     HFIX(f->gran, maxint);
  284.     LFIX(f->dsmax, 0);
  285.     HFIX(f->dsmax, CMAX);
  286.     LFIX(f->dsmin, 0);
  287.     HFIX(f->dsmin, CMAX);
  288.     LFIX(f->intvl, 0);
  289.     HFIX(f->intvl, maxint);
  290.  
  291.     LFIX(f->bd_r, 0);
  292.     HFIX(f->bd_r, CMAX);
  293.     LFIX(f->bd_g, 0);
  294.     HFIX(f->bd_g, CMAX);
  295.     LFIX(f->bd_b, 0);
  296.     HFIX(f->bd_b, CMAX);
  297.  
  298.     LFIX(f->lb_r, 0);
  299.     HFIX(f->lb_r, CMAX);
  300.     LFIX(f->lb_g, 0);
  301.     HFIX(f->lb_g, CMAX);
  302.     LFIX(f->lb_b, 0);
  303.     HFIX(f->lb_b, CMAX);
  304.  
  305.     LFIX(f->hb_r, 0);
  306.     HFIX(f->hb_r, CMAX);
  307.     LFIX(f->hb_g, 0);
  308.     HFIX(f->hb_g, CMAX);
  309.     LFIX(f->hb_b, 0);
  310.     HFIX(f->hb_b, CMAX);
  311.  
  312.     /* db may be negative   */
  313.  
  314.     f->db_r = f->hb_r-f->lb_r;
  315.     f->db_g = f->hb_g-f->lb_g;
  316.     f->db_b = f->hb_b-f->lb_b;
  317. }
  318.  
  319. usage()
  320. {
  321.     printf("Dirk v2.0 copyright (c) 1989 Daniel Elbaum\n");
  322.     printf("\nUsage: dirk [-t|m] [-gN] [-hN] [-lN] [-iN]]...\n");
  323.     printf("t\ttrack tasks only\n");
  324.     printf("m\ttrack memory only\n");
  325.     printf("g   (4)\tgranularity of task mapping (small for few tasks)\n");
  326.     printf("h  (12)\tmaximum detail saturation\n");
  327.     printf("l   (8)\tminimum detail saturation\n");
  328.     printf("i (180)\tinterval in ticks (60 or 50 per second)\n");
  329.     printf("\n...");
  330. printf("\t[-drN] [-dgN] [-dbN] [-erN] [-egN] [-ebN] [-frN] [-fgN] [-fbN]\n");
  331.     printf("dr  (2)\tamount by which to redden the detail pen\n");
  332.     printf("dg  (2)\tamount by which to greeen the detail pen\n");
  333.     printf("db  (0)\tamount by which to bluen the detail pen\n");
  334.     printf("er  (0)\tamount of red for empty memory\n");
  335.     printf("eg  (0)\tamount of green for empty memory\n");
  336.     printf("eb (14)\tamount of blue for empty memory\n");
  337.     printf("fr (14)\tamount of red for full memory\n");
  338.     printf("fg  (0)\tamount of green for full memory\n");
  339.     printf("fb  (0)\tamount by blue for full memory\n");
  340.     return(-1);
  341. }
  342.  
  343.  
  344. SHAR_EOF
  345. cat << \SHAR_EOF > dirk.doc
  346.  
  347.     1/89
  348.  
  349.  
  350.     DIRK v2.0 -- Tune workbench colors to system performance
  351.  
  352.                          -----------------
  353.  
  354.                    Copyright (C) 1989 by Daniel Elbaum
  355.  
  356.          This software is freely redistributable provided that:
  357.          the four files which comprise it (dirk, dirk.doc, dirk.h,
  358.          adjust.c, main.c, sys, window.c) remain intact; all
  359.          copyright notices contained in any of the aforementioned
  360.          files remain intact; and no fee beyond reasonable remuneration
  361.          for collation and distribution be charged for use and/or
  362.          distribution.
  363.  
  364.                          -----------------
  365.  
  366. New Features:
  367.  
  368.     Pressing the right mouse button while the `Dirk' tinywindow
  369.     is active will now expand the window, presenting numerical
  370.     displays of the information Dirk uses.  Clicking the right
  371.     button again while that window is selected will shrink the
  372.     window back to a tinywindow.  Thanks to Steve Tibbett for
  373.     the idea (from later versions of VirusX).
  374.  
  375.     While either the tinywindow or the display window is active,
  376.     Dirk will update constantly.  Just select any other window
  377.     to reinstate the timing interval.
  378.  
  379.     The '-bN' option (background intensity) has been replaced with
  380.     six new optional arguments: three sets of color intensities
  381.     which determine the color of the screen when memory is full
  382.     and empty; at other times, the screen color is taken from an
  383.     interpolation between the two.  See the '-erN ...' and '-frN'
  384.     discussions.  Basically, you specify red, green, and blue
  385.     intensities for the case wherein all memory is free and for
  386.     the case wherein all memory is allocated.
  387.  
  388.     The default detail pen color is now a faint yellow, which
  389.     provides better contrast with a wider range of backgrounds.
  390.  
  391.     The detail pen color arguments (+rN, +gN, +bN) must now be
  392.     preceded with the letter 'd', and the '-' is used instead
  393.     of the '+' to introduce arguments: -drN, -dgN, -dbN.
  394.  
  395.                          -----------------
  396.  
  397. Syntax:
  398.     run Dirk [-t|m] [-gN] [-hN] [-lN] [-iN]]
  399.         [-drN] [-dgN] [-dbN] [-erN] [-egN] [-ebN] [-frN] [-fgN] [-fbN]
  400.  
  401.                          -----------------
  402.  
  403. Parameters:
  404.  
  405.     Option   Default    Effect
  406.     ---------------------------------------------------------------------
  407.         t               track tasks only
  408.         m               track memory only
  409.         g        4      granularity of task mapping (small for few tasks)
  410.         h       12      maximum detail intensity
  411.         l        8      minimum detail intensity
  412.         i      180      interval in ticks (60 or 50 per second)
  413.  
  414.         dr       2      tweak value for red component of detail pen
  415.         dg       2      tweak value for green component of detail pen
  416.         db       0      tweak value for blue component of detail pen
  417.         er       0      amount of red when memory is empty
  418.         eg       0      amount of green when memory is empty
  419.         eb      14      amount of blue when memory is empty
  420.         fr      14      amount of red when memory is full
  421.         fg       0      amount of green when memory is full
  422.         fb       0      amount of blue when memory is full
  423.  
  424.     If you like the program, you may eventually want to start it
  425.     from your startup-sequence, so you might want to dirk around
  426.     with the options before deciding on a command line to use.
  427.  
  428.     My startup-sequence uses this line:
  429.  
  430.         arun dirk -fr12 -er0 -fb0 -eb12 -i20 -h11 pri -5
  431.  
  432.     where `arun' is the ARP version of Run, which would work just
  433.     as well, but for which one would discard the `pri -5' part.
  434.  
  435.  
  436.     Here are all the options explained.
  437.  
  438.     The -t option enables task tracking only.  The background color
  439.     is not affected.
  440.  
  441.     The -m option complements the -t option; only memory tracking is
  442.     turned on.  The detail pen color is not affected.
  443.  
  444.  
  445.  
  446.     The following command line options require counts.  The valid
  447.     range of the count varies from option to option.  All color
  448.     counts should be between 0 and 15; other counts must be
  449.     between 0 and 65535.
  450.  
  451.     Granularity, set with -gN, is the sensitivity with which detail
  452.     pen color responds to the instantaneous number of ready tasks.
  453.     Workable values lie between 1 and 8.
  454.  
  455.     Maximum detail intensity (-hN) is a limit on the brightness of
  456.     the detail pen.  A value of 8 to 14 (14 brighter) can keep
  457.     detail from glaring.  The valid range is 0-15.
  458.  
  459.     Minimum detail intensity -lN (ell not one) is a floor on the
  460.     brightness of the pen, to maintain good contrast to the
  461.     background.  For a light background, l should be at least 8.
  462.  
  463.     The interval (-iN) is the number of ticks to wait between
  464.     data retrieval expeditions.  A tick is 1/60th of a second
  465.     in the US, and 1/50 in Europe.  If N is given as 0, the
  466.     research and reporting are done constantly, and system
  467.     performance slows slightly but noticeably.  180 corresponds
  468.     to ~3 seconds, and is probably a good functional maximum.
  469.  
  470.     The -d arguments specify the detail pen colors.
  471.     As the number of tasks increases, the pen becomes dimmer,
  472.     and as the proportion of active tasks increases, the pen
  473.     becomes yellower.  -drN sets the red component (0-15),
  474.     -dgN sets the green, and -dbN sets the blue.  It's worth
  475.     experimenting to find a combination which provides good
  476.     contrast.
  477.  
  478.     The -e and -f arguments specify the colors at the ends
  479.     of the spectrum.  Values specified with -erN, -egN, and
  480.     -ebN determine the color of the screen when virtually
  481.     no memory is allocated, and values specified with -frN,
  482.     -fgN, and -fbN determine the screen color when memory
  483.     is full.  The greater the difference between the two,
  484.     the finer the correlation between screen shade and memory
  485.     usage.  The defaults (-er0, -eg0, -eb14, -fr14, -fg0, -fb0)
  486.     cause the screen hue to range from blue (no memory in use)
  487.     to red (all memory allocated).
  488.  
  489.     It all sounds confusing but once you run the program
  490.     and see what it does, the meanings of the command line
  491.     options will no doubt fall into place.
  492.  
  493.                          -----------------
  494.  
  495. Description:
  496.  
  497.     The purpose of this program is to present key system
  498.     information to the user without cluttering up the display.
  499.     The workbench background color changes from blue through
  500.     purple to red as the amount of free memory decreases.
  501.     The workbench detail color (the color of text and Workbench
  502.     window borders) changes from bright white to gray as the
  503.     number of system tasks increases.  Further, the yellow
  504.     content of this color is increased according to the number
  505.     of active tasks.
  506.  
  507.     On a newly-booted vanilla system, borders are white and the
  508.     background is close to the standard Workbench blue.  As
  509.     you use the system, calling up programs and creating files
  510.     on the RAMdisk, the screen takes on an increasingly reddish
  511.     hue.  When memory is nearly full, the background is completely
  512.     red.
  513.  
  514.     Similarly, as tasks are added, the borders and text dim
  515.     slightly.  In other words, after you set up dmouse, conman,
  516.     snipit, or whatever to run in the background, the detail color
  517.     fades, eventually to grey.  If many background tasks are
  518.     active rather than just waiting around for an interrupt or
  519.     message, the grey will be tinted yellow.
  520.  
  521.     With Dirk running in the background, you always have a rough
  522.     idea of how much memory is available and how busy the system
  523.     is, without hunting around for the window of your favorite
  524.     resource-tracking gizmo.  If you need more precise information,
  525.     just select the Dirk window and press the right mouse button.
  526.  
  527.                          -----------------
  528.  
  529. Bugs:
  530.     Nary a one, I declare.  Dirk won't function properly if
  531.     your workbench screen is fewer than 115 pixels tall.  But
  532.     then, not many programs will.
  533.  
  534.                          -----------------
  535.  
  536. Signature and self-promo:
  537.  
  538.     If you want to send me money for Dirk, then by all means
  539.     do so--many projects are in progress and I need financing.
  540.     $5.00 is recommended.  Make checks payable to:
  541.  
  542.     Daniel Elbaum
  543.     4816 SE Bybee Blvd.
  544.     Portland, Ore. 97206
  545.  
  546.  
  547.     Send comments, suggestions, and unmitigated praise to:
  548.  
  549.     Daniel Elbaum
  550.     Portland bbs: Amigaboard!, NAG
  551.     UUCP: ...!tektronix!reed!elbaum
  552.     ARPA: elbaum@reed.EDU
  553.  
  554.  
  555.  
  556.  
  557. SHAR_EOF
  558. cat << \SHAR_EOF > dirk.h
  559. /***************************************************************************
  560.     1/89
  561.  
  562.         DIRK v2.0 -- Tune workbench colors to system performance
  563.  
  564.         Copyright (C) 1989 by Daniel Elbaum
  565.  
  566.         This software is freely redistributable provided that:
  567.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  568.         adjust.c, main.c, sys, window.c) remain intact; all
  569.         copyright notices contained in any of the aforementioned
  570.         files remain intact; and no fee beyond reasonable remuneration
  571.         for collation and distribution be charged for use and/or
  572.         distribution.
  573.  
  574. ***************************************************************************/
  575.  
  576.  
  577. #include <exec/types.h>
  578. #include <exec/exec.h>
  579. #include <exec/execbase.h>
  580. #include <intuition/intuition.h>
  581. #include <graphics/gfxbase.h>
  582.  
  583. #define INAM    ("intuition.library")
  584. #define GNAM    ("graphics.library")
  585. #define IREV    (1)
  586. #define GREV    (1)
  587. #define CMAX    (15)    /* max val for color component (hardware)   */
  588.  
  589. #define WINNAME ("Dirk")
  590. #define WINTOP  (0)
  591. #define WINWD   (116)
  592. #define WINHT1  (10)
  593. #define WINHT2  (115)
  594. #define WINFLAGS (WINDOWCLOSE|WINDOWDRAG|WINDOWDEPTH|RMBTRAP)
  595. #define WINIFLAGS (CLOSEWINDOW|ACTIVEWINDOW|INACTIVEWINDOW|\
  596. REFRESHWINDOW|MOUSEBUTTONS)
  597. #define W_OPEN      (0)
  598. #define W_CLOSED    (1)
  599.  
  600. /*
  601.     seems odd, but really makes sense, since background
  602.     has 2 color components, and detail has 3.
  603.     These limits are to ensure enough contrast for readability.
  604. */
  605.  
  606. struct g_flags {
  607.     int gran;   /* granularity of mapping from #tasks to pen brightness */
  608.     int bsmax;  /* constant total saturation of background (red+blue)   */
  609.     int dsmax;  /* maximum detail brightness (if high, text glares)     */
  610.     int dsmin;  /* darkest gray for detail pen                          */
  611.     int dstog;  /* set to activate task watch                           */
  612.     int bstog;  /* set to activate memory watch                         */
  613.     int intvl;  /* number of ticks between updates                      */
  614.     int bd_r;   /* base detail pen red component                        */
  615.     int bd_g;   /* base detail pen green component                      */
  616.     int bd_b;   /* base detail pen blue component                       */
  617.     int lb_r;   /* low background pen red component                     */
  618.     int lb_g;   /* low background pen green component                   */
  619.     int lb_b;   /* low background pen blue component                    */
  620.     int hb_r;   /* high background pen red component                    */
  621.     int hb_g;   /* high background pen green component                  */
  622.     int hb_b;   /* high background pen blue component                   */
  623.  
  624. /* the following three are used internally only */
  625.     int db_r;   /* difference in red from low to high memory usage      */
  626.     int db_g;   /* difference in green from low to high memory usage    */
  627.     int db_b;   /* difference in blue from low to high memory usage     */
  628. };
  629.  
  630.  
  631. typedef struct IntuitionBase t_ib;
  632. typedef struct GfxBase t_gb;
  633. typedef struct g_flags t_gf;
  634.  
  635. extern struct ExecBase *SysBase;
  636.  
  637. struct IntuiMessage *GetMsg();
  638. void *OpenLibrary();
  639. ULONG AvailMem();
  640.  
  641. #ifdef MAIN
  642.  
  643. t_ib *IntuitionBase;
  644. t_gb *GfxBase;
  645.  
  646. #else
  647.  
  648. extern t_ib *IntuitionBase;
  649. extern t_gb *GfxBase;
  650.  
  651. #endif
  652.  
  653.  
  654. SHAR_EOF
  655. cat << \SHAR_EOF > dirk.uu
  656.  
  657. begin 644 dirk
  658. M```#\P`````````#``````````(````"```".P``#`X```/I`````D[Y````)
  659. M```````#[`````$````"`````@````````/R```#Z@```CL`(0`!````````U
  660. M``````````````````#_______________________________\`````````H
  661. M`````````````````````````````````````````````````````````````
  662. M`````````````````````````````````````````````````````````````
  663. M`````````````````````````````````````````````````````````````
  664. M`````````````````````````````````````````````````````````````
  665. M`````````````````````````````````````````````````````````````
  666. M`````````````````````````````````````````````````````````````
  667. M`````````````````````````````````````````````````````````````
  668. M`````````````````````````````````````````````````````````````
  669. M`````````````````````````````````````````````````````````"8.T
  670. M`````````````````````````````````````````````````````````````
  671. M`````````````````````````````````````````````````````````````
  672. M`````````````````````````````````````````````````````````````
  673. M`````````````````````````````````````````````````````````````
  674. M`````````````````````````````````````````````````````````````
  675. M`````````````````````````````````````````````````````````````
  676. M`````````````````````````````````````````````````````````````
  677. M`````````````````````````````````````````````````````````````
  678. M`````````````````````````````````````````````````````````````
  679. M`````````````````````````````````````````````````````````````
  680. M`````````````````````````````````````````````````````````````
  681. M`````````````````````````````````````````````````````````````
  682. M`````````````````````````````````````````````````````````````
  683. M`````````````````````````````````````````````````````````````
  684. M`````````````````````````````````````````````````````````````
  685. M`````````````````````````````````````````````````````````````
  686. M`````````````````````````````````````````````````````````````
  687. M`````````````````````````````````````````````````````````````
  688. M`````````````````````````````````````````````````````````````
  689. M`````````````````````````````````````````````````````````````
  690. M`````````````````````````````````````````````````````````````
  691. M`````````````````````````````````````````````````````````````
  692. M`````````````````````````````````````````````````````````````
  693. M`````````````````````````````````````````````````````````````
  694. M`````````````````````````````````````````````````````````````
  695. M````````````````````````````````````;6%T:&EE965D;W5B8F%S+FQIE
  696. M8G)A<GD`````````````````````````````````````````````````````@
  697. M`````````````````````````````````````````````````````````````
  698. M`````````````````````````````````````````````````````````````
  699. M`````````````````````````````````````````````````````````````
  700. M`````````````````````````````````````````````````````````````
  701. M`````````````````````````````````````````````````````````````
  702. M`````````````````````````````````````````````````````````````
  703. M`````````````````````````````````````````````````````````````
  704. M`````````````````````````````````````````````````````````````
  705. M`````````````````````````````````````````````````````````````
  706. M`````````````````````````````````````````````````````````````
  707. M`````````````````````````````````````````````````````````````
  708. M`````````````````````````````````````````````````````````````
  709. M`````````````````````````````````````````````````````````````
  710. M```````````````````````````````````#[`````$````"```!R```````[
  711. M``/R```#Z0``#`XCSP```#`CP````#@CR````#PL>0````0CS@````23R4ZN5
  712. M_MHH0$JL`*QG``$(80`",I'(("P`K.6((#`($.6(2.<`,$7Y````P$?Y````7
  713. M0"!`<``0&$(P"``FR"`Y````."!Y````/$/P"``,(0`@4LC_^D(I``$2&&=<Z
  714. M#`$`(&?V#`$`"6?P)LH,`0`B9Q04P1(89T(,`0`@9P04P6#R0AI@U!(89S`,5
  715. M`0`B9_(,`0`J9B`2&`P!`$YG!@P!`&YF!'(*8`X,`0!%9P8,`0!E9@)R&Q3!U
  716. M8,Q"$D*3(#P````\D(M&@.2(3-\,`$AY````0"\`3KD``"YX(\`````8(\``L
  717. M```D3KD``"Z((\`````<(\`````@(\`````H(\`````L3KD``"D,<``N>0``0
  718. M`#!.=6$``2QA``$6(\`````T+P!"IR1`("H`)&<0+'D````(($`B*```3J[_#
  719. M@D'Y```&9`P0``!G4"(()#P```/M+'D````(3J[_X@R``````&=$(\`````8O
  720. M(\`````<(\`````@(\`````D(\`````H(\`````L*4``G"E``*#EB"!`*6@`/
  721. M"`"D3KD``"D,<`!@!"`O``1*N0```#1G$B(Y````&&L*+'D````(3J[_W"YY2
  722. M````,"\`+'D````$(#D````(9P8B0$ZN_F(@.0````QG!B)`3J[^8B`Y````]
  723. M$&<&(D!.KOYB2KD````T9PY.KO]\(GD````T3J[^AB`?3G5(YP$&+CP``X`'9
  724. M+'@`!$ZN_Y1,WV"`<&1@`/]Z0>P`7$ZN_H!![`!<3J[^C$YU0_H`$G``3J[]\
  725. MV"/`````"&?`3G5D;W,N;&EB<F%R>0!.<4Y6_Y)(YQ\\1?D``"]@1_D```'`B
  726. M2?D``"F*>`!(;O^26*X`#"\N``Q.N0``#D103TJ`;```"DAX``I.E%A/2'@`Z
  727. M`4AY```&.DZY```O=%!/)H`@$V8``!A(>0``!AA.N0``)/!83TAX`&-.E%A/O
  728. M2'@``4AY```&!DZY```O=%!/(\````'$(#D```'$9@``'DAY```%YDZY```DX
  729. M\%A/+Q-.DEA/2'@`8DZ46$\@4RHH`#QF```H2'D```7*3KD``"3P6$\O$TZ2.
  730. M6$\O.0```<1.DEA/2'@`84Z46$]*A6<``"8@13`H`!1R`#(``H`````/#(``S
  731. M```!9@``!F````@@12H08-9*A68``"A(>0``!:I.N0``)/!83R\33I)83R\YJ
  732. M```!Q$Z26$](>`!@3I183W@`?`%^`"\%3KD```P,6$\F`&8``"A(>0``!8Q.V
  733. MN0``)/!83R\33I)83R\Y```!Q$Z26$](>`!?3I183T'N_Y(@*``49P``#$ZYO
  734. M```-8"U`__1*@V<``/!*A&8``!8@0R\H`%9.N0``+SA83R@`9P``UB!$+6@`^
  735. M%/_L($0]:``8_^HO!$ZY```O3%A/>`!P`"`N_^Q.N0``+9P```1X``0`````6
  736. M!'X`"``````$A`````@```3&```"``````````3X?@%@``!\?@!@``!V<``PQ
  737. M+O_J`H```/__#(````!I9@``*B\&+P-.N0``#-A03PR&`````68``!(O`TZY1
  738. M```(2EA/?`!@```$?`%@```T2H-G```N($,O*`!63KD``"\X6$\H`&<```XO]
  739. M!$ZY```O3%A/8.`O`TZY```OO%A/=@!@`/\.2H-F```8+Q-.DEA/+SD```'$<
  740. M3I)83T*G3I183TJ'9P``#$ZY```OC&```#8Z?```(`U![O^2L*@`&&P``"0@8
  741. M0R\H`%9.N0``+SA83R@`9P``!F````Q.N0``+XQ236#02H9F```,+P-.N0``2
  742. M"$I83TAN_Y(O+O_T+P5.N0``!DS>_``,8`#^ADS?//A.7DYU0V]U;&1N)W0@5
  743. M;W!E;B!$:7)K)W,@=VEN9&]W"@``0V]U;&1N)W0@9FEN9"!7;W)K8F5N8V@@<
  744. M<V-R965N"@!#;W5L9&XG="!F:6YD(&%N>2!S8W)E96YS"@``0V]U;&1N)W0@P
  745. M;W!E;B!G<F%P:&EC<R!L:6)R87)Y"@!G<F%P:&EC<RYL:6)R87)Y``!#;W5L)
  746. M9&XG="!O<&5N(&EN='5I=&EO;B!L:6)R87)Y"@``:6YT=6ET:6]N+FQI8G)A\
  747. M<GD`3E;_S$CG'SPF+@`0+"X`""!#("@`$&<``+Q(;O_L2&[_\$ZY```-K%!/M
  748. M<`\B+O_PTJ[_["!#+Q`O`4ZY```L9B(?6$^0@2@`($.XJ``,;```""!#*"@`K
  749. M#"!#N*@`"&\```@@0R@H``@@0R\0+R[_\$ZY```L9B`?6$_0A"H`#(4````/4
  750. M;P``!'H/($,@!="H`!PF0"`+#(`````/;P``!C9\``\@0R`%T*@`("1`(`H,T
  751. M@`````]O```&-'P`#R!#(`70J``D+@`,AP````]O```$?@\@0R`H`!1G``"L)
  752. M3KD```X4+4#_S'``("X`#)"N_\PM0/_0($,@*``H(&X`$"\H`$`O+O_03KD`K
  753. M`"OT(A]83R\N``PO`4ZY```L9B(?6$_0@2U`_]P@0R`H`"P@;@`0+R@`1"\NG
  754. M_]!.N0``*_0B'UA/+RX`#"\!3KD``"QF(A]83]"!*D`@0R`H`#`@;@`0+R@`"
  755. M2"\N_]!.N0``*_0B'UA/+RX`#"\!3KD``"QF(A]83]"!*$!.N0``+M0@0R`H)
  756. M`!!G```H+P<O"B\+($80*`%+<@`2`"\`(`8&@````"PO`$ZY```OG-[\`!0@,
  757. M0R`H`!1G```J+PPO#2\N_]P@1A`H`4IR`!(`+P`@!@:`````+"\`3KD``"^<4
  758. MWOP`%$ZY```NY$S?//A.7DYU3E;_;$CG'SPT?``0-GP`%"@N``@X?``<.GP`8
  759. M&$'Y```D@BH(2'@`($*G2&[_;$ZY```ML-[\``QV``R#````"&P``"Q(>0`!%
  760. M``$O"TZY```N]%!/0>[_;"(#Y8'1P2"`(!!F```&8```!E*#8,P,@P````AL@
  761. M``!`=@`,@P````AL```L0>[_;"`#Y8#1P"`09P``&"\+0>[_;"`#Y8#1P"\0S
  762. M3KD``"\,4$]2@V#,3-\\^$Y>3G5.N0``+M1(>``"3KD``"\D6$\N`$AX``1.\
  763. MN0``+R183RP`3KD``"[D2&[_]$AN__A.N0``#:Q03R\N__A(>0``"_I(;O_40
  764. M($5.D-[\``PO+O_T2'D```OJ2&[_O"!%3I#>_``,+P=(>0``"]Y(;O^D($5.U
  765. MD-[\``PO!DAY```+TDAN_XP@14Z0WOP`#"!$(F[_;!*H`&,@1")N_VP3:`!BK
  766. M``$@;O]L$7P``0`"=@$,@P````AL```B+PLO+O]L0>[_;"`#Y8#1P"\03KD`A
  767. M`"W@WOP`#%*#8-8@;O]L0F@`!D'Y```+Q")N_VPC2``,0>[_;")N_VS3RB*H>
  768. M``1![O]L(&@`!#%\``H`!D'Y```+MD/N_VPB:0`$(T@`#$'N_VQ#[O]L(FD`%
  769. M!-/*(J@`"$'N_VP@:``(,7P`'@`&0?D```NL0^[_;")I``@C2``,0>[_;$/N0
  770. M_VPB:0`(T\HBJ``,0>[_U$/N_VPB:0`,(T@`#$'N_VP@:``,,7P`*``&0>[_4
  771. M;-'*0^[_;")I``S3RB*00>[_O$/N_VS3RB)1(T@`#$'N_VS1RB!0,7P`,@`&@
  772. M0>[_;-'+0^[_;-/*(E'3RB*00?D```N@0^[_;-/+(E$C2``,0>[_;-'+(%`Q1
  773. M?``&``1![O]LT<L@4#%\`$8`!D'N_VS1S4/N_VS3RR)1T\HBD$'N_Z1#[O]L'
  774. MT\TB42-(``Q![O]LT<T@4#%\`%``!D'N_VS1S$/N_VS3S2)1T\HBD$'N_XQ#G
  775. M[O]LT\PB42-(``Q![O]LT<P@4#%\`%H`!D'N_VS1S"!0T<I"D$AX``Y(>``&^
  776. M+R[_;"!$+R@`,DZY```P`-[\`!!V``R#````"&P``!PO"T'N_VP@`^6`T<`O'
  777. M$$ZY```O#%!/4H-@W&``_5H@($UE;6]R:65S```@("`@5&%S:W,`1&%N:65L-
  778. M($5L8F%U;0`R+C`@("A#*2`Q.3@Y`$9A<W0Z("4W+C=D`$-H:7`Z("4W+C=DE
  779. M`%=A:71I;F<Z("`E,RXS9`!296%D>3H@("`@)3,N,V0`3G%.5O_,2.<8`"8N_
  780. M``A(>``P0J=(;O_03KD``"VPWOP`#"!#,"@`#$C`XD`$0``Z/4#_T$'N_]!"K
  781. M:``"0>[_T#%\`'0`!$'N_]`Q?``*``8@0T/N_]`3:`%*``@@0T/N_]`3:`%+C
  782. M``E![O_0(7P``0`.``Y![O_0(7P`#`(,``I!^0``#5I#[O_0(T@`&D'N_]`Q5
  783. M?``!`"Y![O_0,7P`"@`H0>[_T#%\`'T`+$AN_]!.N0``+^Q83R@`9@``#'``T
  784. M3-\`&$Y>3G4@!&#T8/).5O_\2.<8`"8N``@@+@`,9@``&$AX_Y="IR\#3KD`.
  785. M`#`<WOP`#&```%(@0R!H`"XP*``.2,`@0S(H``9(P9"!`H```/__*``,A````
  786. M`'-L```8<'.0A$2`+P!"IR\#3KD``"_0WOP`#$AX`&E"IR\#3KD``#`<WOP`9
  787. M#$S?`!A.7DYU1&ER:P``3E;_[$CG'P!Z`$ZY```NM"!Y````!"8H`4(@0R`0)
  788. M9P``'"@#($0N*``8($0L*``4(`>0AMJ`($,F$&#>3KD``"[$(`5,WP#X3EY.U
  789. M=4Y6__1(YQP`>@!X`$ZY```NM"!Y````!"8H`99Z`"!#(!!G```*4H4@0R80B
  790. M8/`@>0````0F*`&D>``@0R`09P``"E*$($,F$&#P3KD``"[$(&X`"""%(&X`=
  791. M#""$(`70A$S?`#A.7DYU3E;_^$CG&`!(>``"3KD``"\D6$\H`$AX``1.N0``3
  792. M+R183R8`(`30@TS?`!A.7DYU3E;__$CG'#`F+@`,*"X`"$7Y```8`$?Y```4+
  793. M&GH`($,@O`````0@0R%\````#``(($,A?`````@`#"!#(7P````!`!`@0R%\0
  794. M`````0`4($,A?````+0`&"!#(7P````"`!P@0R%\`````@`@($-"J``D($,A6
  795. M?`````X`-"!#0J@`."!#0J@`/"!#0J@`*"!#0J@`+"!#(7P````.`#`@1"`0,
  796. M9P`"PB!$(%`0$`P``"UF``*J($0@4!`H``%F```,3I-,WPPX3EY.=2!$4I`@.
  797. M4!`09P`"=B!$(%`0$$B`2,`,@````&1M``),!(````!D#(`````0;@`"/.6`3
  798. M0?D```],(G`(`$[1```/_@``$'P``!#Z```/E```#Z@```_4```1>```$7@``
  799. M``^^```/]```$7@``!%X```1>```$7@``!%X```1>```#^H`````($12D"\0$
  800. M3I)83R!#((!2A6```=@@1%*0+Q!.DEA/($,A0``(4H5@``'"($12D"\03I)8I
  801. M3R!#(4``#%*%8``!K"!$4I`O$$Z26$\@0R%``!A2A6```98@0T*H`!1@``&,'
  802. M($-"J``08``!@B!$4I`@4!`02(!(P$ZY```MG```$#````!R```01@```&<`E
  803. M`!!<````8@```````!!R($12D"\03I)83R!#(4``'%*%8```-"!$4I`O$$Z2,
  804. M6$\@0R%``"!2A6```!X@1%*0+Q!.DEA/($,A0``D4H5@```(3I-@`/Z08``!#
  805. M!"!$4I`@4!`02(!(P$ZY```MG```$*X```!R```0Q````&<``!#:````8@``Q
  806. M`````!#P($12D"\03I)83R!#(4``*%*%8```-"!$4I`O$$Z26$\@0R%``"Q2Q
  807. MA6```!X@1%*0+Q!.DEA/($,A0``P4H5@```(3I-@`/X28```AB!$4I`@4!`0/
  808. M2(!(P$ZY```MG```$2P```!R```10@```&<``!%8````8@```````!%N($12)
  809. MD"\03I)83R!#(4``-%*%8```-"!$4I`O$$Z26$\@0R%``#A2A6```!X@1%*0<
  810. M+Q!.DEA/($,A0``\4H5@```(3I-@`/V48```"$Z38`#]BDJ%9P``"%B$8```!
  811. M!F``_8)*A68```A8A&````1Z`&````A.DV``_6)@`/TZ+P-.N0``$<I83R!#9
  812. M(!!F```*($,@O`````%P`&``_3Y.5O_X2.<?/"8N``@T?``\-GP`.#A\`#0ZD
  813. M?``P,'P`+"H(,'P`*"P(,'P`)"X(>`\@0R`0;```!B!#0I`@0R`0L(1O```&!
  814. M($,@A"!#("@`"&P```@@0T*H``@@0R`H``@,@`````]O```,($,A?`````\`;
  815. M""!#("@`#&P```@@0T*H``P@0R`H``P,@`````]O```,($,A?`````\`#"!#7
  816. M("@`&&P```@@0T*H`!@@0R`H`!BPA&\```@@0R%$`!@@0R`H`!QL```(($-"G
  817. MJ``<($,@*``<#(`````/;P``#"!#(7P````/`!P@0R`H`"!L```(($-"J``@X
  818. M($,@*``@#(`````/;P``#"!#(7P````/`"`@0]''(!!L```(($/1QT*0($/1P
  819. MQR`0#(`````/;P``#"!#T<<@O`````\@0]'&(!!L```(($/1QD*0($/1QB`0'
  820. M#(`````/;P``#"!#T<8@O`````\@0]'%(!!L```(($/1Q4*0($/1Q2`0#(``8
  821. M```/;P``#"!#T<4@O`````\@-3@`;```!D*U.``@-3@`#(`````/;P``"BN\D
  822. M````#S@`(#0X`&P```9"M#@`(#0X``R`````#V\```HIO`````\X`"`S.`!LV
  823. M```&0K,X`"`S.``,@`````]O```*)[P````/.``@,C@`;```!D*R.``@,C@`N
  824. M#(`````/;P``"B6\````#S@`(#0X`"!#T<:0D"!#(4``0"`S.``@0]'%D)`@J
  825. M0R%``$0@,C@`D+4X`"!#(4``2$S?//A.7DYU3E8``"\*1?D``"3P2'D``!?2B
  826. M3I)83TAY```7H$Z26$](>0``%XQ.DEA/2'D``!=V3I)83TAY```7.DZ26$](G
  827. M>0``%Q9.DEA/2'D``!;R3I)83TAY```6P$Z26$](>0``%KI.DEA/2'D``!9X"
  828. M3I)83TAY```61DZ26$](>0``%A1.DEA/2'D``!7B3I)83TAY```5NDZ26$]([
  829. M>0``%9!.DEA/2'D``!5F3I)83TAY```5/DZ26$](>0``%11.DEA/2'D``!3LU
  830. M3I)83W#_)%].7DYU9F(@("@P*0EA;6]U;G0@8GD@8FQU92!F;W(@9G5L;"!M8
  831. M96UO<GD*`&9G("`H,"D)86UO=6YT(&]F(&=R965N(&9O<B!F=6QL(&UE;6]R!
  832. M>0H``&9R("@Q-"D)86UO=6YT(&]F(')E9"!F;W(@9G5L;"!M96UO<GD*``!E`
  833. M8B`H,30I"6%M;W5N="!O9B!B;'5E(&9O<B!E;7!T>2!M96UO<GD*``!E9R`@7
  834. M*#`I"6%M;W5N="!O9B!G<F5E;B!F;W(@96UP='D@;65M;W)Y"@!E<B`@*#`I5
  835. M"6%M;W5N="!O9B!R960@9F]R(&5M<'1Y(&UE;6]R>0H`9&(@("@P*0EA;6]UH
  836. M;G0@8GD@=VAI8V@@=&\@8FQU96X@=&AE(&1E=&%I;"!P96X*``!D9R`@*#(IX
  837. M"6%M;W5N="!B>2!W:&EC:"!T;R!G<F5E96X@=&AE(&1E=&%I;"!P96X*`&1R;
  838. M("`H,BD)86UO=6YT(&)Y('=H:6-H('1O(')E9&1E;B!T:&4@9&5T86EL('!E,
  839. M;@H`"5LM9').72!;+61G3ET@6RUD8DY=(%LM97).72!;+65G3ET@6RUE8DY=D
  840. M(%LM9G).72!;+69G3ET@6RUF8DY="@``"BXN+@``:2`H,3@P*0EI;G1E<G9AY
  841. M;"!I;B!T:6-K<R`H-C`@;W(@-3`@<&5R('-E8V]N9"D*``!L("`@*#@I"6UI_
  842. M;FEM=6T@9&5T86EL('-A='5R871I;VX*``!H("`H,3(I"6UA>&EM=6T@9&5TM
  843. M86EL('-A='5R871I;VX*``!G("`@*#0I"6=R86YU;&%R:71Y(&]F('1A<VL@9
  844. M;6%P<&EN9R`H<VUA;&P@9F]R(&9E=R!T87-K<RD*``!M"71R86-K(&UE;6]R:
  845. M>2!O;FQY"@``=`ET<F%C:R!T87-K<R!O;FQY"@`*57-A9V4Z(&1I<FL@6RUT(
  846. M?&U=(%LM9TY=(%LM:$Y=(%LM;$Y=(%LM:4Y=72XN+@H``$1I<FL@=C(N,"!C:
  847. M;W!Y<FEG:'0@*&,I(#$Y.#D@1&%N:65L($5L8F%U;0H`3G%.5O_X2.<<`"8NK
  848. M``AZ`"@%($,0$`P``"!F```&4H-@\"!#$!`,```M9@``!E*#>@$@0Q`0#```V
  849. M,&T``"P@0Q`0#```.6X``"!PT"($TH$D`>6"TH(@0U*#%!!(@DC"TH+0@2@`U
  850. M8,I*A6<```H@!$2`8```!"`$3-\`.$Y>3G5.<4Y6__1(YQ\`)BX`""HN``Q!1
  851. M^0``!<P@"`:`````?R@`($1"$`R#@````&8``%@@!4ZY```MG```&-8````(-
  852. M```8Y@````H``!CP````$````````!CZ0?D``"8"(`A,WP#X3EY.=4'Y```EM
  853. M]B`(8.Y!^0``)>P@"&#D0?D``"7D(`A@VDJ#;```"'`!8```!$*`+@!G```(]
  854. M(`-$@"8`+P4O`TZY```M!B`?6$\L`"\%+P-.N0``+&8@'UA/)@`@>0```<C1]
  855. MQE.$(D02D$J#;LY*AV<```I3A"!$$+P`+2`$8`#_?$Y6_\A(YQ\`*BX`$`R%5
  856. M````(&\```1Z!D'Y```EW$/N``@@*0``(BD`!$ZY```HNDJ`;```"'`!8```7
  857. M!$*`+@!G```@0>X`""`H```B*``$3KD``"BJ0>X`""%````A00`$0>X`""\HM
  858. M``0O*```3KD``"8T4$]![O_8(4```"%!``1![O_80^X`""`I```B*0`$3KD`&
  859. M`"B20>[_X"%````A00`$0?D```7,)@A\`+R%;```CD'Y```EU$/N_^`@*0``+
  860. M(BD`!$ZY```H2D'N_^`A0```(4$`!$'N_^`O*``$+R@``$ZY```F-%!/+P$@M
  861. M`"(?3KD``"CR*``&```P($-2@Q"`(`1.N0``*.)![O_@+P$O`"`H```B*``$`
  862. M+5__R"U?_\Q![O_(3KD``"B20>[_X"%````A00`$4H9@`/]P($-2@T(0<#]!7
  863. M^0``!<PB""0%1(+2@M"!)@!(>0``!<PO`TZY```JB%!/4X,@0Q"\`"Y!^0``W
  864. M)<Q#[O_8("D``"(I``1.N0``*&(O`2\`3KD``"8T4$]![O_0(4```"%!``1!'
  865. M^0``)<1#[O_0("D``"(I``1.N0``*$I![O_8+P$O`"`H```B*``$+5__R"U?-
  866. M_\Q![O_(3KD``"B2+P$@`"(?3KD``"CR*``&```P4X,@0Q"`0>[_T$/N_]@C$
  867. M:``````C:``$``1!^0``);Q#[O_8("D``"(I``1.N0``*+I*@&X`_TY*AV<`<
  868. M``I3@R!#$+P`+2`#3-\`^$Y>3G5.5O_(2.<?("XN`!`,AP```"!O```$?@9!A
  869. M^0``);1#[@`(("D``"(I``1.N0``*+I*@&P```AP`6````1"@"1`(`IG```@V
  870. M0>X`""`H```B*``$3KD``"BJ0>X`""%````A00`$>`!!^0``):Q#[@`(("D`I
  871. M`"(I``1.N0``*+I*@&<``(Y!^0``):1#[@`(("D``"(I``1.N0``*+I*@&T`K
  872. M`"I!^0``)9Q#[@`(("D``"(I``1.N0``*&)![@`((4```"%!``12A&"Z0?D`O
  873. M`"640^X`""`I```B*0`$3KD``"BZ2H!L```J0?D``"6,0^X`""`I```B*0`$/
  874. M3KD``"A*0>X`""%````A00`$4X1@ND'N``@O*``$+R@``$ZY```F-%!/0>[__
  875. MV"%````A00`$0>[_V$/N``@@*0``(BD`!$ZY```HDD'N_^`A0```(4$`!$'Y&
  876. M```%S"8(>@"ZAVP``(Y!^0``)81#[O_@("D``"(I``1.N0``*$I![O_@(4``G
  877. M`"%!``1![O_@+R@`!"\H``!.N0``)C103R\!(``B'TZY```H\BP`!@``,"!#=
  878. M4H,0@"`&3KD``"CB0>[_X"\!+P`@*```(B@`!"U?_\@M7__,0>[_R$ZY```HN
  879. MDD'N_^`A0```(4$`!%*%8`#_<"!#4H,0O`!%2H1M```.($-2@Q"\`"M@```0^
  880. M($-2@Q"\`"T@!$2`*`!Z`DJ%;0``,DAX``HO!$ZY```M!B`?6$\L``8``#`@*
  881. M0]'%$(!(>``*+P1.N0``+&8H'UA/4X5@RB!#0B@``W`Y0?D```7,(@@D!T2".
  882. MTH+0@28`2'D```7,+P-.N0``*HA03U.#($,0O``N0?D``"5\0^[_V"`I```BH
  883. M*0`$3KD``"AB+P$O`$ZY```F-%!/0>[_T"%````A00`$0?D``"5T0^[_T"`I^
  884. M```B*0`$3KD``"A*0>[_V"\!+P`@*```(B@`!"U?_\@M7__,0>[_R$ZY```H2
  885. MDB\!(``B'TZY```H\BP`!@``,%.#($,0@$'N_]!#[O_8(V@`````(V@`!``$3
  886. M0?D``"5L0^[_V"`I```B*0`$3KD``"BZ2H!N`/].(`IG```*4X,@0Q"\`"T@&
  887. M`TS?!/A.7DYU3E;_]$CG&``H+@`00?D``"5D0^X`""`I```B*0`$3KD``"BZ:
  888. M2H!L```80>X`""`H```B*``$3KD``"BJ8```#D'N``@@*```(B@`!$'N__0AR
  889. M0```(4$`!$'Y```E7$/N__0@*0``(BD`!$ZY```HNDJ`;@``($'Y```E5$/N"
  890. M__0@*0``(BD`!$ZY```HNDJ`;```(B\$0>X`""\H``0O*```3KD``!NBWOP`&
  891. M#$S?`!A.7DYU+P1![@`(+R@`!"\H``!.N0``&63>_``,)@`O`TAY```%S$ZYU
  892. M```JB%!/2H1O```L0?D```7,)@@@0Q`09P``!E*#8/13@R!#$!`,```P9@``'
  893. M"B!#4X-"$&#L0?D```7,(`A@E$Y6__A(YQP`*BX`"'@`0?D```7,)@A!^0``Y
  894. M!<PF""!%$!!G```0($52A2)#4H,2D%*$8.JXK@`,;```$"`N`!`@0U*#$(!29
  895. MA&#J($-"$$'Y```%S"`(3-\`.$Y>3G5.5O_X2.<<`"@N``@O!$ZY```JG%A/S
  896. M*@!!^0``!<PF""`%4H6PK@`,;```#B`N`!`@0U*#$(!@Z"\$+P-.N0``*HA0?
  897. M3T'Y```%S"`(3-\`.$Y>3G5.5@``2.<<`"8N``@H+@`,*BX`$$J$;P``&"\%R
  898. M+P0O`TZY```@9-[\``PF`&```!Y*A&P``!@O!2`$1(`O`"\#3KD``"`&WOP`0
  899. M#"8`(`-,WP`X3EY.=4Y6_]9(YQ\\)FX`$$OY```8@"@N``PF+@`(($,0$&<`2
  900. M`TH@0Q`02(!(P$ZY```MG```(4X````E````````)&I2@S1\```L/```!``@C
  901. M0Q`0#```+68```AP`6````1"@"U`__0@+O_T9P``!%*#($,0$$B`2,`H0"`,I
  902. M#(`````P9P``!CA\`"`@0Q`0#```*F8```Y2@R!$)%!8A&```#H@0Q`0#```<
  903. M,&T``"X@0Q`0#```.6X``"(@"M"`(@#E@="!($,2$$B!2,'0@02`````,"1`V
  904. M4H-@R"`N__1G```((`I$@"1`($,0$`P``"YF``!64H,@0Q`0#```*F8```Y2,
  905. M@R!$+!!8A&```#Q\`"!#$!`,```P;0``+B!#$!`,```Y;@``(B`&T(`B`.6!'
  906. MT($@0Q(02(%(P="!!(`````P+`!2@V#(($,0$$B`2,!.N0``+9P``"+*````E
  907. M)0``(N(```!C```B_@```&0``",2````90``(S8```!F```C6@```&<``"-^N
  908. M````;```(X0```!O```CF````',``".P````=0``(\0```!X```D#@```%@`A
  909. M```````D(AU\`"7_UD'N_]9"*``!0>[_UBH(8``!2B!$(!`=0/_60>[_UD(H=
  910. M``%![O_6*@A8A&```2Y(>``*($0O$$Z54$\J`%B$8``!&B\&($0O*``$+R@`=
  911. M`$ZY```;HM[\``PJ`%"$+#P```0`8```]B\&($0O*``$+R@``$ZY```99-[\3
  912. M``PJ`%"$+#P```0`8```TB\&($0O*``$+R@``$ZY```>[M[\``PJ`%"$+#P`2
  913. M``0`8```KE*#8`#^TDAX``@@1"\03I503RH`6(1@``"4($0J$%B$2H5F```*W
  914. M0?D``"5,*@A@``!\2'@`"B!$+Q!.E5!/*@!8A&```&A(>``0($0O$$Z54$\J5
  915. M`"X%($<0$&<``"X@1Q`0#```06T``!X@1Q`0#```6FX``!(@1Q`02(!(P`8`X
  916. M`"`@1Q"`4H=@S%B$8```'DAX`!`@1"\03I503RH`6(1@```*0?D``"5$*@@O?
  917. M!4ZY```JG%A/L(9O```(($71QD(0+PPO"B\%3KD``""XWOP`#"H`($40$&<`W
  918. M``X@15*%(DM22Q*08.Q@```*($,B2U)+$I!2@V``_+)"$TS?//A.7DYU3E8`E
  919. M`"\#)BX`""\#2&X`$"\N``Q.N0``(0[>_``,(`,F'TY>3G5.5O_\+P-!^0``M
  920. M`<PF""\#2&X`$"\N``Q.N0``(0[>_``,+RX`""\#3KD``"J<6$\O`$AX``$OB
  921. M`TZY```G#-[\`!`F'TY>3G5.5O_\+P-!^0```<PF""\#2&X`#"\N``A.N0``!
  922. M(0[>_``,0?D```9H(`@&@````"`O`"\#3KD``"J<6$\O`$AX``$O`TZY```GP
  923. M#-[\`!`F'TY>3G4M3T]04RT``"AN=6QL*0``.\><H0R20BM$%:\=>+6,0```Y
  924. M``````````````````!`)````````$`D````````0"0```````!`)```````0
  925. M`#_P````````0"0```````!`)```````````````````````````````````W
  926. M`````$`D````````0"0```````!`)```````````````````+4]/4%,M```X_
  927. M,#`P,#`P,```+3(Q-#<T.#,V-#@`,C`P,#`P,#`P,#``,#$R,S0U-C<X.4%"N
  928. M0T1%1D=(24I+3$U.3U!14E-455976%E:``!.5O_\0>X`""`H```B*``$3KD`/
  929. M`"CR+4#__"`N__Q.N0``*.).7DYU3E;_^$'N``@O*``$+R@``$ZY```F-%!//
  930. M0>[_^"%````A00`$0>[_^$/N``@@*0``(BD`!$ZY```HNDJ`;```'D'Y```G"
  931. M`D/N__@@*0``(BD`!$ZY```H>DY>3G5![O_X("@``"(H``1@[F#L3E8``$'Y.
  932. M```F^D/N``@@*0``(BD`!$ZY```H>B\!+P!.N0``)C103TZY```HXDY>3G4_X
  933. MX````````#_P````````3G%.5O_T2.<?("8N`!0N+@`()&X`#'P`+PHO+@`0?
  934. M3KD``"OT(!]83RH`($,@*``,($.0J``$L(5L```2($,@*``,($.0J``$8```U
  935. M!"`%*``O!"!#("@`&B!#T*@`!"\`+P=.N0``*FC>_``,W(2:A-Z$($/9J``4D
  936. M($/9J``$($,@*``(($.PJ``$;```#"!#(D,C:``$``@@0P`H``$`&$J%9P``+
  937. M)B\#3KD``"M(6$\H``R$_____V8```P@!$S?!/A.7DYU8```!F````9@`/]:>
  938. M+P-.N0``*TA83R\*+P9.N0``+&8@'UA/8-).<4CGP,`@.0````QF```^0_D`E
  939. M``9,<``L>0````1.KOW8(\`````,9@``(DCG`08N/``#@`4L>``$3J[_E$S?]
  940. M8(!(>`!D3KD``"F*+$!,WP,#3G5(YS`"3KD``"?X3-@`#$ZN_[),WT`,3G5($
  941. MYS`"3KD``"?X3-@`#$ZN_ZQ,WT`,3G5(YS`"3KD``"?X3-@`#$ZN_[Y,WT`,W
  942. M3G5(YS`"3KD``"?X3-@`#$ZN_[A,WT`,3G4O#DZY```G^$ZN_\0L7TYU2.<PV
  943. M`DZY```G^$S8``Q.KO_63-]`#$J`9@1P`&`(:P1P`6`"</].=2\.3KD``"?X#
  944. M3J[_W"Q?3G4O#DZY```G^$ZN_^(L7TYU0H%.=4*!3G5.<4Y6```O"D7Y```J#
  945. ML$*Y```(Z$AX`H!(>0``!FA.N0``*RQ03TAX`0`O.0```!A"ITZ2WOP`#$AXY
  946. M`0`O.0```!Q(>``!3I+>_``,2'@!`"\Y````($AX``).DM[\``PO+@`,+RX`C
  947. M"$ZY```"A%!/0J=.N0``*8I83R1?3EY.=4Y6__Q(YQ`P1?D```CH1_D``"H$:
  948. M2'D```9H3I-83T'Y```&:"`(!H`````@+P!.DUA/0?D```9H(`@&@````$`OI
  949. M`$Z36$\@$F<``!H@4B80(%(O*``(+Q).N0``+PQ03R2#8.(O+@`(3KD```'$P
  950. M6$],WPP(3EY.=4YQ3E;__$CG&``F+@`(+P-.N0``*TA83T*G($,@*``4($.0$
  951. MJ``0+P`@0R@0+P1.N0``+IC>_``,($,O*``,($,O*``:3KD``"\,4$](>``@#
  952. M+P-.N0``*RQ03R`$3-\`&$Y>3G5.<4Y6```O+@`0+RX`""\N``Q.N0``+>#>5
  953. M_``,3EY.=4YQ(&\`!")O``@0V6;\("\`!$YU3G$@;P`$2AAF_)'O``13B"`(@
  954. M3G5.<4Y6__Q(YQ@`*"X`$&8```1X`4'Y```&:"`((BX`".N!T($F`&<``%)"W
  955. MIR!#(40`#"\H``Q.N0``+O103R!#(4``&B`H`!IG```P0J="IR!#(*X`#"\0+
  956. M3KD``"Z8WOP`#"!#(4``%")#(V@`%``0(`-,WP`83EY.=7``8/1.5@``+RX`Y
  957. M#$*G+RX`"$ZY```ML-[\``Q.7DYU3E;_]$CG'B`F+@`(-'P`$'P`($,0*``8B
  958. M2(!(P`*``````6<``'(@0R`H`!0@0Y"H``0J`"`R.`"PA6<``!I"IR`%D+(X\
  959. M`"\`($,O$$ZY```NF-[\``P@0R\H``0@0R\H`!H@0R\03KD``"Y<WOP`#"@`7
  960. M($.XJ``$9P``#'S_2H1L```$>``@!="$)8`X`"!#`BC__@`8($-"J``(($-"=
  961. MJ``$(`9,WP1X3EY.=4Y6``!(Y_@`2FX`"&8``!Y*;@`,9@``%C`N``K`[@`.;
  962. M+4``"$S?`!].7DYU>`$D+@`(;```!D2"1(0F+@`,;```!D2#1(1"@#`"P,,R+
  963. M`DA"Q,-(0\+#TH)(04)!T(%*A&P```1$@"U```A,WP`?3EY.=4Y6```O`$IN/
  964. M``QF'"`N``AK%H#N``YI$`*```#__RU```@@'TY>3G5(YWP`>@$@+@`(;`1$M
  965. M@$2%)@`B+@`,;`1$@42%*`$,@0`!``!L%$)`2$"`P30`,`.`P4A`,`)(0&`J_
  966. MXHCBB0R!``$``&ST@,$"@```__\D`"\`+P1A`/\0(!]83[:`;`)3@B`"2H5LV
  967. M`D2`+4``"$S?`#X@'TY>3G5.5@``2.?X`$IN``QF'"`N``AK%H#N``YI$$)`Q
  968. M2$`M0``(3-\`'TY>3G5X`2`N``AL!$2`1(0D`"(N``QL`D2!#($``0``;!!"`
  969. M0$A`@,$P`H#!0D!(0&`L)@'BB.*)#($``0``;/2`P0*```#__R\`+P-A`/YZW
  970. M(!]83[2`9`*0@Y""1(!*A&P"1(`M0``(3-\`'TY>3G4@7R)8(@EG!K"89O9.:
  971. MT2!03M!.<4Y6__1(YQX`*BX`""P%*"X`#"8N`!!*@V\```P@1E*&$(13@V#P9
  972. M(`5,WP!X3EY.=4Y6__1(YQ\`+"X`$"XN``A*AFX```P@!TS?`/A.7DYU*BX`%
  973. M#"@'NH1N```X(`93@"(%TH`@`;"$;0``*"`&4X#:@"`&4X#8@"8&2H-O```07
  974. M($53A2)$4X02D%.#8.Q@```8)@9*@V\``!`@15*%(D12A!*04X-@["`'8)Q(5
  975. MYQ`"3.\`#@`,+'D````(3J[_T$S?0`A.=4YQ+PXL>0````A.KO_*+%].=2\.U
  976. M+'D````(3J[_Q"Q?3G5(YQ`"3.\`#@`,+'D````(3J[_ODS?0`A.=4YQ+PXL4
  977. M>0````1.KO^(+%].=2\.+'D````$3J[_@BQ?3G4O#BQY````!$ZN_WPL7TYUJ
  978. M+PXL>0````1.KO]V+%].=2\.3.\``P`(+'D````$3J[_.BQ?3G5.<2\.(F\`A
  979. M""`O``PL>0````1.KO\N+%].=2\.(B\`""QY````!$ZN_R@L7TYU+PX@;P`('
  980. M+'D````$3J[^C"Q?3G4O#B)O``@L>0````1.KOZ&+%].=2\.(F\`""QY````%
  981. M!$ZN_F(L7TYU+PXB;P`(("\`#"QY````!$ZN_=@L7TYU+PXL>0```<1.KO[RZ
  982. M+%].=4CG$`(@;P`,3.\`#P`0+'D```'$3J[^X$S?0`A.=4YQ+PX@;P`(+'D`V
  983. M``'`3J[_N"Q?3G4O#B!O``A,[P`#``PL>0```<!.KO]8+%].=4YQ+PX@;P`(Z
  984. M+'D```'`3J[_-"Q?3G4O#DSO`P``"$SO``,`$"QY```!P$ZN_R@L7TYU+PX@H
  985. M;P`(3.\``P`,+'D```'`3J[^X"Q?3G5.<0```^P```!E`````0``,"H``#`0]
  986. M```O]```+]X``"_$```OK```+Y```"^````O:```+U0``"]````O+```+Q@`7
  987. M`"[^```NZ```+M@``"[(```NN```+J0``"Z,```N?```+F@``"K$```I7```C
  988. M*4@``"DV```I)```*:```"FJ```IO@``*1H``"F4```G_@``*!H``"@(```E<
  989. M%```&)(``!E````:"@``&JX``!K````<]@``'?H``!X,```?P```']0``!_^?
  990. M```@%@``(!X``"!6```@?@``(*H``"2P```D^```#7(```W````-W````I0`-
  991. M``,&```##````U````.F```#X@``!0H```%@`````@````@````.````&@``;
  992. M`$8```!,````7@```&0```#>````[@```/P```$"```!#@```10```$:```!?
  993. M(````2X```$^```!4````70```&&```!C````9(```&8```!G@```:0```'*C
  994. M```!T@```=H```'D```!\@```@````(.```"'````B@```)N```!)P````(`Z
  995. M`"NP```KE@``*SP``"L(```JY@``*GH``"I6```J2```*C(``"H4```I]```3
  996. M*>0``"F:```I=```*2H``"D4```I?@``*#X``"A0```H:```*(```"B8```HB
  997. MK@``*,```"CF```H]@``)^P``">T```GX```)VX``"<J```FL```)N```":2Q
  998. M```F5```)O(``"9&```F;@``)IX``";.```FZ@``).(``"4V```@=```)"X`A
  999. M`"32```E)@``&NH``!Q8```>-@``&L@``!X4```?Q@``(*(``!IL```=6```#
  1000. M&E@``!M(```=1```'I0``!HL```;&@``')X``!T8```>9@``&?@``!J.```;J
  1001. M/```'.0``!UZ```>B```&=0``!I*```:]```',```!TV```>0```&;8``!OV%
  1002. M```?)@``&9```!N````;S@``'!P``!PZ```<@```'LP``!\.```?6@``'W@`#
  1003. M`!DT```=Y```&20``!W(```8L@``(3H``")>```8M@``&+X``!C&```8T@``!
  1004. M&-@``!CH```8\@``&/P``!E^```:&@``&M@``!L(```;;@``&[P``!P*```<0
  1005. M*```'$8``!QN```<C```'08``!XD```>5```'KH``![\```?2```'V8``!^2B
  1006. M```?L@``(-H``"#Z```A'```(3X``"%*```B8@``(FH``")R```B>@``(H(`0
  1007. M`"**```BD@``(IH``"*B```BJ@``(K(``"*Z```BQ@``(R```"-$```C:```Y
  1008. M(Z8``"0D```D2```))@``"3"```E"@``%"(``!`,```0B@``$0@```Y6```.%
  1009. M7```#T(```],```/4```#U0```]8```/7```#V````]D```/:```#VP```]PO
  1010. M```/=```#W@```]\```/@```#X0```^(```/C```$!```!`8```0(```$"P`=
  1011. M`!".```0E@``$)X``!"J```1#```$10``!$<```1*```$:X``!0H```4,@``5
  1012. M%#P``!1&```44```%%H``!1D```4;@``%'@``!2"```4C```%)8``!2@```4J
  1013. MJ@``%+0``!2^```4R```%-(``!3<```.(@``#C````V>```-^```#6P```VZ4
  1014. M```-.```#/8```U*```,O```#"0```R,```+;@``"<P```D,```)&@``".X`J
  1015. M``N2```(F```"'H```AH```(/@``"20```@"```(-```!]8```D"```'5@``M
  1016. M!X@```>X```'+```!H@```:^```'9@``!Y@```?(```&<```"3(```D^```)O
  1017. M5```"6@```E\```)X@``"@P```H^```*P@``!7@```4@```%5```!/````2T&
  1018. M```%9@``!*````1,```$/```!.0```0<```$U```!4(```0````#P````N0`S
  1019. M``,<```#0@```Y@```/4```"S@```OX```*N```"F@```HX```+(```"W@``L
  1020. M`O@```,6```#/````Y(```/.```$4```!%@```1@```$:```!'0```$F```!8
  1021. 1O````0@```#V`````````_+.^
  1022. ``
  1023. end
  1024. size 16352
  1025. SHAR_EOF
  1026. cat << \SHAR_EOF > main.c
  1027.  
  1028. /***************************************************************************
  1029.     1/89
  1030.  
  1031.         DIRK v2.0 -- Tune workbench colors to system performance
  1032.  
  1033.         Copyright (C) 1989 by Daniel Elbaum
  1034.  
  1035.         This software is freely redistributable provided that:
  1036.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  1037.         adjust.c, main.c, sys, window.c) remain intact; all
  1038.         copyright notices contained in any of the aforementioned
  1039.         files remain intact; and no fee beyond reasonable remuneration
  1040.         for collation and distribution be charged for use and/or
  1041.         distribution.
  1042.  
  1043. ***************************************************************************/
  1044.  
  1045. #define MAIN
  1046. #include "dirk.h"
  1047. #define ODD_BEHAVIOR
  1048.  
  1049. main(c, v)
  1050. char **v;
  1051. {
  1052.     register i, active;
  1053.     register ULONG tm;
  1054.     register wtog;
  1055.     ULONG Class;
  1056.     USHORT Code;
  1057.     struct Screen *sp;
  1058.     struct Window *wp;
  1059.     register struct IntuiMessage *msg=NULL;
  1060.     t_gf g_f;
  1061.     struct Window *getwin();
  1062.     ULONG totmem();
  1063.     void redowin(), setcolors(), fillwin();
  1064.  
  1065.     if (getargs(++v, &g_f)<0) exit(10);
  1066.  
  1067.     if (!(IntuitionBase=(t_ib *)OpenLibrary(INAM, IREV))){
  1068.         printf("Couldn't open intuition library\n");
  1069.         exit(99);
  1070.     }
  1071.     if (!(GfxBase=(t_gb *)OpenLibrary(GNAM, GREV))){
  1072.         printf("Couldn't open graphics library\n");
  1073.         CloseLibrary(IntuitionBase);
  1074.         exit(98);
  1075.     }
  1076.     if (!(sp=IntuitionBase->FirstScreen)){
  1077.         printf("Couldn't find any screens\n");
  1078.         CloseLibrary(IntuitionBase);
  1079.         CloseLibrary(GfxBase);
  1080.         exit(97);
  1081.     }
  1082.     for (; sp; sp=sp->NextScreen)
  1083.         if ((sp->Flags&SCREENTYPE)==WBENCHSCREEN)
  1084.             break;
  1085.     if (!sp) {
  1086.         printf("Couldn't find Workbench screen\n");
  1087.         CloseLibrary(IntuitionBase);
  1088.         CloseLibrary(GfxBase);
  1089.         exit(96);
  1090.     }
  1091.     msg=NULL;
  1092.     wtog=W_CLOSED;
  1093.     active=0;   /* ACTIVATE not requested by getwin()   */
  1094.     if (!(wp=getwin(sp))){
  1095.         printf("Couldn't open Dirk's window\n");
  1096.         CloseLibrary(IntuitionBase);
  1097.         CloseLibrary(GfxBase);
  1098.         exit(95);
  1099.     }
  1100.     if (g_f.bstog) tm=totmem();
  1101.     for (;;) {
  1102.         while (wp&&(msg||(msg=GetMsg(wp->UserPort)))){
  1103.             Class=msg->Class;
  1104.             Code=msg->Code;
  1105.             ReplyMsg(msg);
  1106.             msg=NULL;
  1107.             switch(Class){      /* assume sizeof(int)==sizeof(ULONG)    */
  1108.                 case ACTIVEWINDOW:
  1109.                     active=1;
  1110.                     break;
  1111.                 case INACTIVEWINDOW:
  1112.                     active=0;
  1113.                     break;
  1114.                 case MOUSEBUTTONS:
  1115.                     if ((Code&0xFFFF)==MENUDOWN){
  1116.                         redowin(wp, wtog);
  1117.                         if (wtog==W_CLOSED) {fillwin(wp); wtog=W_OPEN;}
  1118.                         else wtog=W_CLOSED;
  1119.                     }
  1120.                     break;
  1121.                 case CLOSEWINDOW:
  1122.                     if (wp){
  1123.                         while (msg=GetMsg(wp->UserPort))
  1124.                             ReplyMsg(msg);
  1125.                         CloseWindow(wp);
  1126.                         wp=NULL;
  1127.                     }
  1128.                     break;
  1129.             }
  1130.         }
  1131.         if (!wp) {
  1132.             CloseLibrary(IntuitionBase);
  1133.             CloseLibrary(GfxBase);
  1134.             exit(0);
  1135.         }
  1136.         if (active)
  1137.             WaitTOF();
  1138.         else{
  1139.             for (i=0; i<g_f.intvl; ++i)
  1140.                 if (msg=GetMsg(wp->UserPort)) break;
  1141.                 else WaitTOF();
  1142.         }
  1143.         if (wtog==W_OPEN) fillwin(wp);
  1144.         setcolor(sp, tm, &g_f);
  1145.     }
  1146.     /* NOTREACHED   */
  1147. }
  1148.  
  1149.  
  1150. SHAR_EOF
  1151. cat << \SHAR_EOF > makefile
  1152. #
  1153. #   1/89
  1154. #
  1155. #   This makefile is for PDC.  rom.lib is just a
  1156. #   public-domain version of amiga.lib.
  1157. #
  1158.  
  1159. COBJ = main.o adjust.o window.o sys.o arg.o
  1160. INCL = dirk.h
  1161. PROG = dirk
  1162.  
  1163. sharp: $(COBJ)
  1164.     blink to $(PROG) from PDCLIB:acrt0.o $(COBJ) +
  1165.     lib PDCLIB:pdc.lib PDCLIB:rom.lib nodebug smallcode smalldata
  1166.  
  1167. $(COBJ): $*.c $(INCL)
  1168.     cc -Ii: -bq $*.c
  1169.     as $*.s
  1170.  
  1171. SHAR_EOF
  1172. cat << \SHAR_EOF > sys.c
  1173. /***************************************************************************
  1174.     1/89
  1175.  
  1176.         DIRK v2.0 -- Tune workbench colors to system performance
  1177.  
  1178.         Copyright (C) 1989 by Daniel Elbaum
  1179.  
  1180.         This software is freely redistributable provided that:
  1181.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  1182.         adjust.c, main.c, sys, window.c) remain intact; all
  1183.         copyright notices contained in any of the aforementioned
  1184.         files remain intact; and no fee beyond reasonable remuneration
  1185.         for collation and distribution be charged for use and/or
  1186.         distribution.
  1187.  
  1188. ***************************************************************************/
  1189.  
  1190.  
  1191. #include "dirk.h"
  1192.  
  1193. /*
  1194.     Find the total amount of system memory
  1195.     by cruising the master list.
  1196. */
  1197.  
  1198. ULONG
  1199. totmem()
  1200. {
  1201.     register ULONG tu, tl, tm=0;
  1202.     register struct Node *n;
  1203.     register struct MemHeader *m;
  1204.  
  1205.     Disable();
  1206.     for (n=SysBase->MemList.lh_Head; n->ln_Succ; n=n->ln_Succ){
  1207.         m=(struct MemHeader *)n;
  1208.         tu=(ULONG)m->mh_Upper;
  1209.         tl=(ULONG)m->mh_Lower;
  1210.         tm+=tu-tl;
  1211.     }
  1212.     Enable();
  1213.     return(tm);
  1214. }
  1215.  
  1216. /*
  1217.     Hunt up all ready tasks and waiting tasks;
  1218.     put their respective counts in r and w.
  1219. */
  1220.  
  1221. tqlen(r, w)
  1222. int *r, *w;
  1223. {
  1224.     register tr=0, tw=0;
  1225.     register struct Task *t;
  1226.  
  1227.     Disable();
  1228.     t=SysBase->TaskReady.lh_Head;
  1229.     for (tr=0; t->tc_Node.ln_Succ; t=t->tc_Node.ln_Succ)
  1230.         tr++;
  1231.     t=SysBase->TaskWait.lh_Head;
  1232.     for (tw=0; t->tc_Node.ln_Succ; t=t->tc_Node.ln_Succ)
  1233.         tw++;
  1234.     Enable();
  1235.     *r=tr;
  1236.     *w=tw;
  1237.     return(tr+tw);
  1238. }
  1239.  
  1240. /*
  1241.     Place amt of free chip mem into cm;
  1242.     place amt of free fast mem into fm.
  1243. */
  1244.  
  1245. ULONG
  1246. amtfree()
  1247. {
  1248.     ULONG c, f;
  1249.  
  1250.     c=AvailMem(MEMF_CHIP);
  1251.     f=AvailMem(MEMF_FAST);
  1252.     return(c+f);
  1253. }
  1254. SHAR_EOF
  1255. cat << \SHAR_EOF > window.c
  1256.  
  1257. /***************************************************************************
  1258.     1/89
  1259.  
  1260.         DIRK v2.0 -- Tune workbench colors to system performance
  1261.  
  1262.         Copyright (C) 1989 by Daniel Elbaum
  1263.  
  1264.         This software is freely redistributable provided that:
  1265.         the four files which comprise it (dirk, dirk.doc, dirk.h,
  1266.         adjust.c, main.c, sys, window.c) remain intact; all
  1267.         copyright notices contained in any of the aforementioned
  1268.         files remain intact; and no fee beyond reasonable remuneration
  1269.         for collation and distribution be charged for use and/or
  1270.         distribution.
  1271.  
  1272. ***************************************************************************/
  1273.  
  1274.  
  1275. #include "dirk.h"
  1276.  
  1277. /*
  1278.     Just give me a window and don't make me
  1279.     put endless initializations into main()
  1280.     or global space, okay?
  1281. */
  1282.  
  1283. /*
  1284.     sp arg is more for symmetry than for anything else.
  1285. */
  1286.  
  1287. struct Window *
  1288. getwin(sp)
  1289. struct Screen *sp;
  1290. {
  1291.     struct NewWindow nw;
  1292.     struct Window *wp;
  1293.  
  1294.     memset(&nw, 0, sizeof(nw));
  1295.     nw.LeftEdge = (sp->Width/2)-(WINWD/2);
  1296.     nw.TopEdge = WINTOP;
  1297.     nw.Width = WINWD;
  1298.     nw.Height = WINHT1;
  1299.     nw.DetailPen = sp->DetailPen;
  1300.     nw.BlockPen = sp->BlockPen;
  1301.     nw.Flags = WINFLAGS;
  1302.     nw.IDCMPFlags = WINIFLAGS;
  1303.     nw.Title=WINNAME;
  1304.     nw.Type=WBENCHSCREEN;
  1305.     nw.MinHeight=WINHT1;
  1306.     nw.MaxHeight=WINHT1+WINHT2;
  1307.     if (!(wp = OpenWindow(&nw))) {
  1308.         return((struct Window *)NULL);
  1309.     }
  1310.     else return(wp);
  1311. }
  1312.  
  1313. void
  1314. redowin(wp, oldstatus)
  1315. struct Window *wp;
  1316. {
  1317.     int d2bot;
  1318.  
  1319.     if (oldstatus==W_OPEN) SizeWindow(wp, 0, -(WINHT2-WINHT1));
  1320.     else {
  1321.         d2bot=(wp->WScreen->Height-wp->TopEdge)&0xFFFF;
  1322.         if (d2bot<WINHT2)
  1323.             MoveWindow(wp, 0, -(WINHT2-d2bot));
  1324.         SizeWindow(wp, 0, WINHT2-WINHT1);
  1325.     }
  1326. }
  1327.  
  1328. SHAR_EOF
  1329. #    End of shell archive
  1330. exit 0
  1331. -- 
  1332. Bob Page, U of Lowell CS Dept.  page@swan.ulowell.edu  ulowell!page
  1333. Have five nice days.
  1334.